package com.tanhua.server.controller;

import com.tanhua.server.service.AnnouncementsService;
import com.tanhua.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @version 1.0
 * @author： xtr
 * @date： 2021-03-10 17:18
 */
@RestController
@RequestMapping("/messages")
public class AnnouncementsController {

    @Autowired
    private AnnouncementsService announcementsService;

    @GetMapping("/announcements")
    public ResponseEntity getAnnouncement(@RequestParam(value = "page",defaultValue = "1") long page,
                                          @RequestParam(value = "pagesize",defaultValue = "10") long pagesize){
        PageResult pageResult = announcementsService.getAnnouncement(page,pagesize);
        return ResponseEntity.ok(pageResult);
    }
}
